<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
	<head>
		<?php echo $this->getChildHtml('head') ?>
		<base target="_parent" />
	</head>
<body <?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
<div class="headtitle">
	<h4><?php echo $this->__('Product Review') ?></h4> 
</div>	
<div class="productreview-main">
<?php
    $_helper = $this->helper('catalog/output');
    $_product = Mage::registry('current_product');
	$tabs = Mage::helper('productreview')->getTabs();
?>

<div class="clear"></div>
<div class="product-info-box">
	<!-- Tabs Product Overview -->
	   <div id="product-info-wrapper">	
			<div class="product-img-box">
				<?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>
				<div class="media-box">
					   <div>
					 <p class="product-image-zoom">

						<?php
						  $_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(180).'" alt="'.$this->htmlEscape($_product->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
						  echo $_helper->productAttribute($_product, $_img, 'image')
						?>
						</p>
					   
						</div>
					   
				</div>
				<?php else: ?>
					<?php
						$_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(180).'" alt="'.$this->htmlEscape($_product->getImageLabel()).'" />';
						echo $_helper->productAttribute($_product, $_img, 'image')
					?>
				<?php endif; ?>
			</div>
			
			<div class="product-info">  
				<div class="main-info">
					<h3 class="product-name">
						
						<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
					</h3>
			 
						<?php echo "Price : ".Mage::helper('core')->currency($_product->getFinalPrice()) ?>
						
					<div class="price-box">
						<?php if($_product->getSpecial_price() != null): ?>

							<?php 
							
							$main_price = $_product->getPrice();
							$special_price = $_product->getSpecial_price(); 
							
							?>
							<?php if($main_price > $special_price):?>
								<p class="old-price">
									<span class="price-label"><?php echo $this->__('Retail value:'); ?></span>
									<span class="price"><?php echo Mage::helper('core')->currency($main_price) ?></span>
								</p>
							<?php endif; ?>
							<p class="special-price"><span class="price"><?php echo Mage::helper('core')->currency($special_price) ?></span></p>
						<?php endif; ?>
					</div>
						 
					<?php $stock =  Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product); ?>
						 
					<?php  echo intval($stock->getQty())." in stock " ?><br/>
					<strong><?php echo "Ships In : ".$_product->getHandlingtime() ?></strong> <br/>
				</div>		
				<br/>
					
				<?php if(intval($stock->getQty())>0):?>
					<a class="form-button btn-addtocart" href="<?php echo $this->helper('checkout/cart')->getAddUrl($_product) ?>">Add To Cart</a> 
				<?php endif; ?>
				
				<a class="form-button btn-goto" href="<?php echo $_product->getProductUrl() ?>" >
					Go To
				</a>
			</div>
			<div class="clear"></div>
	    </div>
	<div class="productreview-tab">
		
		 <!-- Tabs -->
		<ul class="subsection_tabs" id="tabs_example_one">
			<?php if(in_array('description', $tabs)){?>
				<li class="tab curve"><a href="#Description" class="active">Description</a></li>
			<?php }?>
			<?php if(in_array('related', $tabs)){?>
				<li class="tab"><a href="#Related" class="">Related Products</a></li>
			<?php }?>
			<?php if(in_array('addinfo', $tabs)){?>
				<li class="tab"><a href="#Additional" class="">Additional Information</a></li>
			<?php }?>
			<?php if(in_array('recommend', $tabs)){?>
				<li class="tab"><a href="#Upsell" class="">We Also Recommend</a></li>
			<?php }?>
			<?php if(in_array('reviews', $tabs)){?>
				<li class="tab" style="border:none;"><a href="#Reviews" class="">Reviews</a></li>
			<?php }?>
		</ul>
		 
		<div class="clear"></div>
		
		<!-- Tab Product Description -->
		<?php if(in_array('description', $tabs)){?>
        <div id="Description" class="tab-container" style="display:none;">
			<div class="collateral-box">
				<div class="product-specs">
					<div class="head">
						<h4><?php echo $this->__('Description') ?></h4> 
					</div>
					<div>                      
						<?php echo $this->helper('catalog/output')->productAttribute($_product, nl2br($_product->getDescription()), 'description') ?>
						<ul>
							<?php if($_product->getBrand()): ?>
							<li>
								<span class="at-lb"><?php echo $this->__('Brand : ')?></span>
								<span class="at-vl"><?php echo $_product->getBrand(); ?></span>
							</li>
							<?php endif;?>

							<?php if($_product->getDimensions()): ?>
							<li>
								<span class="at-lb"><?php echo $this->__('Dimensions : ')?></span>
								<span class="at-vl"><?php echo $_product->getDimensions(); ?></span>
							</li>
							<?php endif;?>

							<?php if($_product->getWarrantyDescription()): ?>
							<li>
								<span class="at-lb"><?php echo $this->__('Warranty Description : ')?></span>
								<span class="at-vl"><?php echo $_product->getWarrantyDescription(); ?></span>
							</li>
							<?php endif;?>

							<?php if($_product->getWeight()): ?>
							<li>
								<span class="at-lb"><?php echo $this->__('Weight : ')?></span>
								<span class="at-vl"><?php echo $_product->getWeight(); ?></span>
							</li>
							<?php endif;?>

							<?php if($_product->getSku()): ?>
							<li>
								<span class="at-lb"><?php echo $this->__('SKU : ')?></span>
								<span class="at-vl"><?php echo $_product->getSku(); ?></span>
							</li>
							<?php endif;?>

						</ul>
					</div>
				</div>
			</div>	
	    </div>
		<?php }?>
		
		
		<?php if(in_array('related', $tabs)){?>
		<!-- Tabs Product Related --> 
		<div id="Related" class="tab-container" style="display:none;">
			<div class="collateral-box">
				<div class="product-specs">
					<div class="head">
						<h4><?php echo $this->__('Related Products') ?></h4> 
						
					</div>
		  <!-- Get Related product -->
		  <?php
			$_related = $_product;
			// get the parent id to skip
			$_parentid = $_related->getId();

			if ($_related) {
				// get collection of categories this product is associated with
				$categories =$_related->getCategoryCollection()
				->setPage(1, 1)
				->load();

				// if the product is associated with any category
				
				if ($categories->count())
				foreach ($categories as $_category)
				{
					$cur_category = Mage::getModel('catalog/category')->load($_category->getId());
			?>
					<div>
						<div>
							<?php
								$visibility = array(
									Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
									Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
								);

								$products = Mage::getResourceModel('catalog/product_collection')
											->addCategoryFilter($_category)
											->addAttributeToFilter('visibility', $visibility)
											->addAttributeToSelect('small_image');

								$products->getSelect()->limit(20,6);

								// count the number of displayed products
								$_i=0;
								if(count($products)>0)
								foreach ( $products as $productModel ) {
								$_related = Mage::getModel('catalog/product')->load($productModel->getId());
								$_realtedid = $_related->getId();

								// prevents displaying the same product your are already on
								if ($_realtedid != $_parentid && $_i<6):

							?>
								
							<div class="productBox">
								<div class="productImg">
									<li class="item">
											<a class="product-image" href="<?php echo $_related->getProductUrl() ?>">
												<img src="<?php echo $this->helper('catalog/image')->init($_related, 'small_image')->resize(105,75) ?>" width="105" height="75" alt="<?php echo $this->htmlEscape($_related->getName()) ?>" /></a>
									</li>
								</div>
								<div class="clearfix productTitle">
									<p class="proname1" style="margin-bottom:3px;"><a style="font-weight:normal;"  href="<?php echo $_related->getProductUrl() ?>"><?php echo substr($this->htmlEscape($_related->getName()), 0, 42); ?></a></p>
									
									<div class="price-box">
										<?php if($_related->getSpecial_price() != null): ?>

											<?php 
											
											$main_price = $_related->getPrice();
											$special_price = $_related->getSpecial_price(); 
											
										
											?>
											<?php if($main_price > $special_price):?>
												<p class="old-price">
													<span class="price-label"><?php echo $this->__('Retail value:'); ?></span>
													<span class="price"><?php echo Mage::helper('core')->currency($main_price) ?></span>
												</p>
											<?php endif; ?>
											<p class="special-price"><span class="price"><?php echo Mage::helper('core')->currency($special_price) ?></span></p>
											
										<?php endif; ?>
									</div>
									
								</div>
							</div>

							<?php
							// increment displayed products
							$_i++;
							endif;
							}
							else
								echo $this->getChildHtml('catalog.product.related');
							?>


				<?php }
				
					
						}
				
				?>
					
						</div>
						<script type="text/javascript">decorateTable('upsell-product-table')</script>
					</div>
		                        
				</div>
			</div>
			
	    </div>
		
		<?php }?>
		
		<?php if(in_array('addinfo', $tabs)){?>
		<div id="Additional" class="tab-container" style="display:none;">
			<?php echo $this->getChildHtml('additional') ?>

		</div>
		<?php }?>
		
		<?php if(in_array('recommend', $tabs)){?>
		<div id="Upsell" class="tab-container" style="display:none;">
			<?php echo $this->getChildHtml('upsell_products') ?>
		</div>
		<?php }?>
		
		<?php if(in_array('reviews', $tabs)){?>
		<!-- Tabs Product Review --> 
		<div id="Reviews" class="tab-container" style="display:none;">
			<div class="collateral-box">		
				<div class="product-specs">
					<div class="head">
						<h4><?php echo $this->__('Reviews') ?></h4> 
						
					</div>
											
					 <?php echo $this->getChildHtml('reviews'); echo $this->getChildHtml('product_additional_data');?>
				</div>
			</div>
			
	     </div>
		<?php }?>
	</div>
    <div class="clear"></div>
    
  </div>
</div>
<script type="text/javascript" src="<?php echo $this->getJsUrl('tabs/livepipe.js') ?>" ></script>
<script type="text/javascript" src="<?php echo $this->getJsUrl('tabs/tabs.js') ?>" ></script>
<script type="text/javascript">
	jQuery(document).ready(function() {
		new Control.Tabs('tabs_example_one');
	});
</script>
		</div>
        <?php echo $this->getChildHtml('before_body_end') ?>
	</body>
</html>


